import Mock from "mockjs";
const Random = Mock.Random;

//总览数据
export const overview = Mock.mock({
  code: 200,
  data: {
    file: Random.float(60, 100, 2, 2) + "M",
    "article|0-50": 0,
    "gallery|0-50": 0,
    "diary|0-50": 0,
  },
});

//访问量数据
export const visit = Mock.mock({
  "data|30": [
    {
      //时间
      "date": "@datetime('MM-dd')",
      "count|10-60": 12,    
    }
  ]
});

//数据监测
export const survey = Mock.mock({
  "data": {
    "device": [
      {
        'key': 'mobile',
        "name": "移动端",
        "value|30-120": 50,
      },
      {
        'key': 'pc',
        "name": "PC端",
        "value|30-120": 50,
         },
    ],
    "website": [
      {
        "key": "home",
        "name": "首页",
        "value|30-120": 50,
      },
      {
        "key": "project",
        "name": "项目",
        "value|30-120": 50,
      },
      {
        "key": "diary",
        "name": "日记",
        "value|30-120": 50,
      },
      {
        "key": "photo",
        "name": "摄影",
        "value|30-120": 50,
      }
    ]
    }
  
});

//评论数据
export const comment = Mock.mock({
    "count": 123,
    "list|123": [
      {
        "id|+1": 1,
        "article": {
          "id|+1": 2,
          "title":"@ctitle(3, 12)",
        },
        "user": {
          "id|+1": 3,
          "name": "@ctitle(3, 12)",
          "imgurl":"https://www.huohuo90.com:3003/user/6353b034dd4b583975e77fbe.png"
        },
        "comment": "@cparagraph(1, 4)",
        "moment": "@datetime()",
        "complaint|0-12": 0,
      }
    ]
});

//文章状态
export const state = Mock.mock({
  "data": [
    {
      "id": 0,
      "name": "已发布",
      "count|0-30": 5,
    },
    {
      "id": 1,
      "name": "未发布",
      "count|0-30": 5,
    },
  ]
})

//文件分组
export const subset = Mock.mock({
  "data":{
    "count": 123,
    "list|4": [
      {
        "id|+1": 0,
        "name": "@ctitle(2, 6)",
        "count|0-30": 5,
        "moment": "@datetime()",
      }
    ]
  }
})

//图片合集
const photos = [
  "a.jpeg",
  "b.jpeg",
  "c.jpeg",
  "d.jpg",
  "e.jpeg",
  "f.jpeg",
  "g.jpeg",
  "h.jpeg",      
  "i.jpeg",  
  "j.jpeg",
  "k.jpeg",
  "l.jpeg",
  "m.jpeg",
  "n.jpeg",
  "o.jpeg",
  "p.jpeg",
]

//文件数据
export const mkfiles = Mock.mock({
    "count":64,
    "list|64":[{
        "id|+1":0,
       "url|1":photos,
       "fileName":"@ctitle(3, 20)",
       "format":"jpeg",
       "subsetId|0-3":3,
    }]
})

//文章标签
export const mklabel = Mock.mock({
  "data":{
    "count": 123,
    "list|20": [
      {
        "id|+1": 0,
        "name": "@ctitle(2, 4)",
        "moment": "@datetime()",
      }
    ]
  }
})

//文章数据
export const mkarticle = Mock.mock({
  "count":123,
  "list|64":[{
    "id|+1":0,
    "title":"@ctitle(3, 12)",
    "cover|1":photos,
    "moment": "@datetime()",
    "label|0-2":"@ctitle(2,4)   ",
    "introduce":"@cparagraph(1, 4)",
    "view|0-120": 12,
    "comment|0-120": 12,
    "praise|0-120": 12,
    "subsetId|0-4":1,
    "state|0-1":0,
}]
})

const photoArr=[
  ["a.jpeg", "b.jpeg", "c.jpeg"],
  ["d.jpeg", "e.jpeg"],
  ["f.jpeg"],
  ["g.jpeg", "h.jpeg", "i.jpeg", "j.jpeg"],
]

//文章数据
export const mkgallery = Mock.mock({
  "count":123,
  "list|64":[{
    "id|+1":0,
    "title":"@ctitle(3, 12)",
    "cover|1":photos,
    "moment": "@datetime()",
    "content|1":photoArr,
    "label|0-2":"@ctitle(2,4)   ",
    "introduce":"@cparagraph(1, 4)",
    "view|0-120": 12,
    "comment|0-120": 12,
    "praise|0-120": 12,
    "subsetId|0-4":1,
}]
})

//日记数据
export const mkdiary = Mock.mock({
  "count":123,
  "list|64":[{
    "id|+1":0,
    "title":"@ctitle(3, 12)",
    "moment": "@datetime()",
    "weather_id|0-7":0,
    "content":"@cparagraph(2, 10)",
    "picture|01":photoArr,
}]
})

//图片列表
export const mkphotos = Mock.mock({
   "data|6":[{
    "id|+1":0,
    "url|1":photos,
   }]
})

